package t4;

import java.io.IOException;
import java.util.Scanner;

import t4bean.StallBean;

/**
 * 客户端直接调用，判断调用那个功能
 *
 */
public class Tools {
//	List<Stock> stockList = new ArrayList<Stock>();
//	List<PurchaseOrder> purList = new ArrayList<PurchaseOrder>();
//	List<SalesvolumeRecord> salList = new ArrayList<SalesvolumeRecord>();
//	List<PurchaseDate> purDateList = new ArrayList<PurchaseDate>();
//	List<SalesvolumDate> salDateList = new ArrayList<SalesvolumDate>();
//	Stall stall = new Stall(purList, salList, stockList, purDateList, salDateList);
	
	StallBean stall=new StallBean();
	{
		Deserialization ds=new Deserialization();
		try {
			stall=ds.deserialization();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
	public int run(Scanner cin, Integer in) throws IOException {

		switch (in) {
		case 1:
			CinPurchase cp = new CinPurchase();
			stall = cp.cinPurchase(cin, stall);
			break;
		case 2:
			CinSellFruit csf = new CinSellFruit();
			stall = csf.cinSellFruit(stall, cin);
			break;
		case 3:
			ShowAllSalesvolumeRecord sasr = new ShowAllSalesvolumeRecord();
			sasr.showAllSalesvolumeRecord(stall);
			break;
		case 4:
			ShowFruit sf = new ShowFruit();
			sf.showFruit(stall);
			break;
		case 5:
			ShowThreeFruit stf = new ShowThreeFruit();
			stf.showThreeFruit(stall);
			break;
		case 6:
			CinDateProfit cdp = new CinDateProfit();
			cdp.cinDateProfir(cin, stall);
			break;
		case 0:
			Serialize ser=new Serialize();
			ser.serialize(stall);
			break;
		default:
			System.out.println("输入错误");
		}
		return in;
	}
}
